package com.fuful.service;

import com.fuful.domain.Users;
import com.fuful.mappers.UsersMapper;
import com.fuful.tools.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

public class UsersService {

    public boolean register(){

        return false;
    }

    public Users login(String parUName, String parUpwd){
        SqlSession sqlSession = MybatisUtil.getSqlSession();
        UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
        Users users = usersMapper.findByUserName(parUName);
        if(users != null){
            if(users.getUpwd().equals(parUpwd)){
                return users;
            }
        }
        MybatisUtil.closeSqlSession();
        return null;
    }

}
